package com.yserp.project.erp.order.deliveryorder.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yserp.common.utils.mybatis.MybatisPlusUtil;
import com.yserp.project.erp.order.deliveryorder.domain.DeliveryOrderItem;
import com.yserp.project.erp.order.deliveryorder.mapper.DeliveryOrderItemMapper;
import com.yserp.project.erp.order.deliveryorder.service.IDeliveryOrderItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 发货订单子Service业务层处理
 *
 * @author yserp
 * @date 2022-07-26
 */
@Service
public class DeliveryOrderItemServiceImpl extends ServiceImpl<DeliveryOrderItemMapper, DeliveryOrderItem> implements IDeliveryOrderItemService {
    @Resource
    private DeliveryOrderItemMapper deliveryOrderItemMapper;


    /**
     * 查询发货订单子列表
     *
     * @param deliveryOrderItem 发货订单子
     * @return 发货订单子
     */
    @Override
    public List<DeliveryOrderItem> selectDeliveryOrderItemList(DeliveryOrderItem deliveryOrderItem) {
        QueryWrapper<DeliveryOrderItem> queryWrapper = new QueryWrapper<>();
        MybatisPlusUtil.notNullField(deliveryOrderItem,queryWrapper);
        return deliveryOrderItemMapper.selectList(queryWrapper);
    }

    /**
     * 通过主表ID,获取字表列表
     */
    @Override
    public List<DeliveryOrderItem> selectDeliveryOrderItemListByMainId(Long mainId){
        DeliveryOrderItem deliveryOrderItem = DeliveryOrderItem.builder().mainId(mainId).build();
        return this.selectDeliveryOrderItemList(deliveryOrderItem);
    }

}
